import { asyncRoutes } from "./routes"
import { AppRouteRecordRaw } from "./types"

const ROUTE_MAP: Record<string, any> = {};

const generateRouteMap = (routes: AppRouteRecordRaw[]) => {
  return routes.map(route => {
    if (route.children && route.children.length > 0) {
      generateRouteMap(route.children)
    }
    ROUTE_MAP[route.name] = route.component
  })
}

generateRouteMap(asyncRoutes)
// console.log("🚀 ~ ROUTE_MAP:", ROUTE_MAP)

export {ROUTE_MAP}
